package net.lzzy.practices;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author 1
 */
@Configuration
@EnableOpenApi
public class SwaggerConfig {
    private ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .description("本接口适用于软件技术专业web及uni-app课程教学")
                .title("Practices接口文档1.0")
                .contact(new Contact("lzzy.retry","https://moocl.chaoxing.com/course/247428660.html","abc@lzzy.net"))
                .version("V1.0")
                .build();
    }

    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("net.lzzy.practices.web"))
                .paths(PathSelectors.any())
                .build();
    }
}
